<#include "/common/_layout.html">
<#assign pageJavascript>
<script type="text/javascript" src="/assets/rabbit/jquery.imgup.js"></script>
<script type="text/javascript">
$(function(){
	$("#rid").val("${(sysAdmin.rid)!}");
	$("#form1").Validform({
		tiptype:5,
		beforeSubmit:function(curform){
			var para = $(curform).serializeObject();
			$.extend(para,{"sysAdmin.id":"${(sysAdmin.id)!}"});
			var loadIndex = layer.load();
			$.post("/admin/system/user/save?v="+Math.random(),para,function(data){
	           if (data.msg == 'success') {
	        	   layer.alert('保存成功！',{icon: 6},function(index){
	        		   layer.close(index);
	        		   window.location="/admin/system/user";
	        	   });
	           }
		       else {layer.msg('保存失败！', {icon: 5});}
	           layer.close(loadIndex);
			});
			return false;	
		}
	});
	$("#imgbtn").click(function(){
		alert($(".imgbb").imgup('getImgs'));
	});
	$(".imgbb").imgup({muti:true,imgs:[]});
	//$(".imgbb").imgup({imgs:['http://img.wxfenxiao.com/aa/c5/2016-04/5715db41ce023.png','http://img.wxfenxiao.com/aa/c5/2016-04/5715db410ef11.png','http://img.wxfenxiao.com/aa/c5/2016-04/5715db41ce023.png','http://img.wxfenxiao.com/aa/c5/2016-04/5715db41ce023.png']});
});
</script>
</#assign>
<@layout pageTitle="人员管理" pageJavascript=pageJavascript pageCss=pageCss>	
<h3 class="page-header">人员管理</h3>	
<form id = "form1" class="form-horizontal">
  <div class="form-group">
    <label for="username" class="col-sm-2 control-label">人员名</label>
    <div class="col-xs-10 col-sm-5">
      <input type="text" id="username" value="${(sysAdmin.username)!}" name="sysAdmin.username" datatype="s2-20" <#if admin??> disabled</#if> class="form-control">
    </div>
  </div>  
  <div class="form-group">
    <label for="nickname" class="col-sm-2 control-label">昵称</label>
    <div class="col-xs-10 col-sm-5">
      <input type="text" id="nickname" name="sysAdmin.nickname" value="${(sysAdmin.nickname)!}" datatype="s2-40" class="form-control">
    </div>
  </div>  
  <div class="form-group">
    <label for="email" class="col-sm-2 control-label">邮箱</label>
    <div class="col-xs-10 col-sm-5">
      <input type="text" id="email" name="sysAdmin.email" value="${(sysAdmin.email)!}" datatype="*1-120,e" class="form-control">
    </div>
  </div>
  <div class="form-group">
    <label for="rid" class="col-sm-2 control-label">分配角色</label>
    <div class="col-xs-10 col-sm-5">
    	<select name="sysAdmin.rid" id="rid" class="form-control">
		<#if rolelist??>
		<#list rolelist as data>
		<option value="${data.id}">${data.rname}</option>
		</#list>
		</#if>	
		</select>
    </div>
  </div>
  <div class="form-group">
    <label for="password" class="col-sm-2 control-label">密码</label>
    <div class="col-xs-10 col-sm-5">
      <input type="password" id="password" name="sysAdmin.password" 
      	<#if sysAdmin??>datatype="*0-0|password"<#else>datatype="password"</#if> class="form-control">
    </div>
  </div>
  <div class="form-group">
    <label for="repassword" class="col-sm-2 control-label">重复密码</label>
    <div class="col-xs-10 col-sm-5">
      <input id="repassword" type="password" datatype="*0-22" recheck="sysAdmin.password" class="form-control">
    </div>
  </div>
  <div class="form-group">
    <label for="mobile" class="col-sm-2 control-label">手机号</label>
    <div class="col-xs-10 col-sm-5">
      <input type="mobile" id="mobile" name="sysAdmin.mobile" value="${(sysAdmin.mobile)!}" datatype="m" class="form-control">
    </div>
  </div>
  <div class="form-group">
    <label for="remark" class="col-sm-2 control-label">备注</label>
    <div class="col-xs-10 col-sm-5">
      <textarea  id="remark" name="sysAdmin.remark" datatype="*0-200" class="form-control" >${(sysAdmin.remark)!}</textarea>
    </div>
  </div>
  <div class="form-group">
    <label for="remark" class="col-sm-2 control-label">图片插件演示</label>
    <div class="col-xs-10 col-sm-5 j-imglistPanel">
        <input type="hidden" name="file_path" class="imgbb" value="http://img.wxfenxiao.com/aa/c5/2016-04/5715db41ce023.png,http://img.wxfenxiao.com/aa/c5/2016-04/5715db410ef11.png">
        <p class="help-block">建议上传尺寸640px * 640px</p>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button id="imgbtn" type="button" class="btn">图片</button>
      <button type="submit" class="btn btn-success">提交</button>
      <a href="/admin/system/user" class="btn btn-default">取消</a>
    </div>
  </div>
</form>
</@layout>